<div class = "main-view">
    <div class="left-margin top-margin"><strong class="am-text-primary am-text-lg">抽奖活动奖品管理</strong></div>
    <br>
    <div class="am-btn-group am-btn-group-xs left-margin top-margin">
        <button type="button" class="am-btn am-btn-default" data-am-modal="{target: '#doc-modal-add', width: 800, height: 600}"><span class="am-icon-plus"></span>添加奖品</button>
        <button type="button" class="am-btn am-btn-default" ng-click="delete()"><span class="am-icon-trash-o"></span> 删除</button>
        <button type="button" class="am-btn am-btn-default" ng-click="back()"><span class="am-icon-trash-o"></span> 返回</button>
    </div>
    <div id = "pagination" class = "pagination"></div>
    <div class="pagination-table left-margin" id="tab_menu" style = "margin-top: 0px;">
        <form class="am-form">
            <table class="am-table-striped am-table-hover table-main">
                <thead>
                <tr>
                    <th class="table-check"><input type="checkbox" ng-click="allSelected()"></th>
                    <th>序号</th>
                    <th>奖品名称</th>
                    <th>奖品等级名称</th>
                    <th>中奖名额</th>
                    <th>奖励数量</th>
                    <th>奖品等级</th>
                    <th>奖品位置</th>
                    <th>中奖几率</th>
                    <th>创建时间</th>
                    <th>操作</th>
                </tr>
                </thead>
                <tbody>
                <tr ng-repeat="result in resultList"  id = "{{result.id}}">
                    <td class="table-check"><input type="checkbox" class = "item-check"></td>
                    <th>{{result.id}}</th>
                    <th>{{result.prize_name}}</th>
                    <th>{{result.level_name}}</th>
                    <th>{{result.prize_count}}</th>
                    <th>{{result.reward_count}}</th>
                    <th>{{result.prize_level}}</th>
                    <th>{{result.prize_position}}</th>
                    <th>{{result.prize_probability}}</th>
                    <th>{{result.create_time|date:"yyyy-MM-dd HH:mm"}}</th>
                    <th>
                        <button type="button" class="am-btn am-btn-default am-btn-xs am-text-secondary"  data-am-modal="{target: '#doc-modal-{{$index}}', width: 800, height: 600}" ng-click="updateShow(result,$index)">编辑</button>
                        <!--编辑框 -->
                        <div class="am-modal am-modal-no-btn" tabindex="-1" id="doc-modal-{{$index}}">
                            <div class="am-modal-dialog">
                                <div class="am-modal-hd border-bottom" style = "text-align: left;">抽奖奖品编辑
                                    <a href="javascript: void(0)" class="am-close am-close-spin" data-am-modal-close>&times;</a>
                                </div>
                                <div class="am-modal-bd body-area">
                                    <div class = "text-left">
                                        <label class="control-label">奖品：</label>
                                        <select id="productId_Edit{{$index}}" ng-model ="result.product_id">
                                            <option ng-repeat=" product in productList " value="{{product.value}}">{{product.name}}</option>
                                        </select><br>
                                        <label style="width: auto">奖品等级名称：(例:一等奖、二等奖)</label><br>
                                        <input class = "modal-input" style="width: 600px" ng-model="result.level_name" required tabindex="5"><br>
                                        <label style="width: auto">中奖名额：</label><br>
                                        <input class="modal-input" style="width: 600px" ng-model="result.prize_count" required tabindex="5"><br>
                                        <label style="width: auto">奖品奖励数量：</label><br>
                                        <input class="modal-input" style="width: 600px" ng-model="result.reward_count" required tabindex="5"><br>
                                        <label style="width: auto">奖品等级：(这里填数字，例:一等奖填1、二等奖填2)</label><br>
                                        <input class="modal-input" style="width: 600px" ng-model="result.prize_level" required tabindex="5"><br>
                                        <label style="width: auto">奖品位置：(从0开始,0设置成谢谢参与)</label><br>
                                        <input class="modal-input" style="width: 600px" ng-model="result.prize_position" required tabindex="5"><br>
                                        <label style="width: auto">中奖几率：(小数，例：1就是100%中奖，0.01就是1%的中奖几率，所有奖品中奖几率总和必须为1)</label><br>
                                        <input class="modal-input" style="width: 600px" ng-model="result.prize_probability" required tabindex="5"><br>
                                        <!--<label>奖品图片</label><br>-->
                                        <!--<div class="col-xs-5">-->
                                            <!--<input type="file" id="pict"-->
                                                   <!--onchange="angular.element(this).scope().selectFile(this.files)" accept="image/*"></div>-->
                                        <!--<br /><br />-->
                                    </div>
                                </div>
                                <div class = "button-area border-top">
                                    <button type="button" class="am-btn am-btn-success right-margin top-margin" ng-show="true" ng-click="update(result,$index)">保存</button>
                                </div>
                            </div>
                        </div>
                    </th>
                </tr>
                </tbody>
            </table>
        </form>
    </div>
    <div class = "left-margin">共<span id = 'page_number'>{{pageNumber}}</span>页 <span>{{count}}条数据</span></div>

    <!--新增框 -->
    <div class="am-modal am-modal-no-btn" tabindex="-1" id="doc-modal-add">
        <div class="am-modal-dialog">
            <div class="am-modal-hd border-bottom" style = "text-align: left;">新增抽奖活动奖品
                <a href="javascript: void(0)" class="am-close am-close-spin" data-am-modal-close>&times;</a>
            </div>
            <div class="am-modal-bd body-area text-left">
                <form>
                    <label class="control-label">奖品：</label>
                    <select id="productId">
                        <option ng-repeat=" product in productList " value="{{product.value}}">{{product.name}}</option>
                    </select><br>
                    <label style="width: auto">奖品等级名称：(例:一等奖、二等奖)</label><br>
                    <input class = "modal-input" style="width: 600px" ng-model="levelName" required tabindex="5"><br>
                    <label style="width: auto">中奖名额：</label><br>
                    <input class="modal-input" style="width: 600px" ng-model="prizeCount" required tabindex="5"><br>
                    <label style="width: auto">奖品奖励数量：</label><br>
                    <input class="modal-input" style="width: 600px" ng-model="rewardCount" required tabindex="5"><br>
                    <label style="width: auto">奖品等级：(这里填数字，例:一等奖填1、二等奖填2)</label><br>
                    <input class="modal-input" style="width: 600px" ng-model="prizeLevel" required tabindex="5"><br>
                    <label style="width: auto">奖品位置：(从0开始,0设置成谢谢参与)</label><br>
                    <input class="modal-input" style="width: 600px" ng-model="prizePosition" required tabindex="5"><br>
                    <label style="width: auto">中奖几率：(小数，例：1就是100%中奖，0.01就是1%的中奖几率，所有奖品中奖几率总和必须为1)</label><br>
                    <input class="modal-input" style="width: 600px" ng-model="prizeProbability" required tabindex="5"><br>
                    <label>奖品图片</label><br>
                    <div class="col-xs-5">
                        <input type="file" id="pict"
                               onchange="angular.element(this).scope().selectFile(this.files)" accept="image/*"></div>
                    <br /><br />
                    <!--<div class="form-group">-->
                        <!--<button ng-click="cannel()" class="btn btn-xs btn-primary">取消</button>-->
                        <!--<button ng-click="add()" class="btn btn-xs btn-primary" type="submit">保存</button>-->
                    <!--</div>-->
                </form>
            </div>
            <div class = "button-area border-top">
                <button type="button" class="am-btn am-btn-success right-margin top-margin" ng-show="true" ng-click="add(addData)" data-target = "cascad-search-add">保存</button>
            </div>
        </div>
    </div>
</div>
